<script type="text/javascript" src="<?= BASE ?>/js/main_menu.js"></script>

<?php

$opened_menu_items = array("My actions", "Languages");

if(isset($_COOKIE["menu"])){
	$opened_menu_items = array();
	foreach(explode("|",$_COOKIE["menu"]) as $item){
		$opened_menu_items[] = $item;
	}
}

$menu = array(
	"My actions" => array(
		"Inbox" => "",
		"Articles written" => "",
		"Feedback given" => "",
		"Manage profile" => "",	
		"Organize My Tags" => "javascript:TagsUser();"
	),

	"Views" => array(
		"Local events" => "",
		"Favorite sports" => "",
		"European football" => "",
		"My local news" => "",
		"World economy" => "",
		"Local business" => "",
		"Organize Views" => ""
	),

	"Stories" => array(
		"12 finance people get stuck..." => "",
		"Squatters in Saif al-islam..." => "",
		"Organize Stories" => ""
	),

	"Authors" => array(
		"John Williams" => "",
		"Mamdouh Habib" => "",
		"Organize Authors" => ""
	),

	"Organizations" => array(
		"Bubbles and Beyond" => "",
		"Oxford University" => "",
		"Organize Stories" => ""
	),

	"Saved Articles" => array(
		"Cube prevents tourists from..." => "",
		"Gamal Mubarak spotted in..." => "",
		"Organize Saved Articles" => ""
	),

	"GeoTags" => array(
		"Oulu" => "", 
		"Finland" => "",
		"Cairo" => "", 
		"Egypt" => "",
		"Equatorial Guinea" => "",
		"Search GeoTags" => ""
	),

	"PeopleTags" => array(
		"Domique Strauss-Kahn" => "",
		"Osama bin Laden" => "",
		"Muammar Gaddafi" => "",
		"Search People" => ""
	),

	"SubjectTags" => array(
		"FIFA" => "",
		"Arab spring" => "",
		"Spanish Uprising" => "",
		"Search Subjects" => ""
	),

	"Languages" => array(
		"English" => "",
		"Dansk" => "",
		"Deutsch" => "",
		"Francais" => "",
		"Hrvatski" => "",
		"Italiano" => "",
		"Polski" => "",
		"Italiano" => ""
	)
);
?>
<ul id="main_menu">
<? foreach($menu as $label=>$items): ?>
	<li class="<? if(in_array($label,$opened_menu_items)): ?> opened<? endif; ?>">
		<strong><?= $label ?></strong>
		<ul class="submenu">
		<? foreach($items as $l=>$link): ?>
			<li><a href="<?= $link ?>">&raquo; <?= $l; ?></a></li>
		<? endforeach; ?>
		</ul>
	</li>
<? endforeach; ?>
</ul>